close all
clear all

alldata=[
0 0 5;
2 1 3;
3 2 4;
0 3 3;
1 4 3;
0 5 5;
0 7 1;
5 8 5;
0 9 3];

alldata(:,1) = alldata(:,1)+1;
alldata(:,2) = alldata(:,2)+1;
num_users = 6;
num_items =10;
num_rates = size(alldata,1);
rate_matrix_double = zeros(num_users, num_items, 5);
rate_matrix = boolean(rate_matrix_double);
rate_matrix_template = boolean(rate_matrix_double);
clear rate_matrix_double

tmp_index = 0;
for m=1:num_rates
    if mod(m,10000)==0
        fprintf(1,'%4.9f\n',m/num_rates);
    end
    rate_matrix(alldata(m,1), alldata(m,2), alldata(m,3)) = 1;
    rate_matrix_template(alldata(m,1), alldata(m,2), :) = 1;
end

dd= reshape(rate_matrix,num_users*num_items, 5 );

A=rate_matrix(:,:,1);
B=rate_matrix(:,:,2);
C=rate_matrix(:,:,3);
D=rate_matrix(:,:,4);
E=rate_matrix(:,:,5);